//
//  PartitionColor.m
//  CleanerAir_Project
//
//  Created by 付亚杰 on 16/5/16.
//  Copyright © 2016年 Beijing Colin El Internet. All rights reserved.
//

#import "PartitionColor.h"

@implementation PartitionColor



- (void)setValue:(id)value forKey:(NSString *)key{
    
//    if ([key isEqualToString:@"date"]) {
//            
//            self.date = [[Partition alloc] init];
//            [self.date setValuesForKeysWithDictionary:value];
//            ; 
//        
//        return;
//    }
    
    [super setValue:value forKey:key];
    
    if ([key isEqualToString:@"color"]) {
        self.aqi = value;
    }
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
} 
@end




@implementation Partition

- (void)setValue:(id)value forKey:(NSString *)key{
    
    if ([key isEqualToString:@"airpot"]) {
        
        for (NSDictionary *aDic in value) {
            
            Color *col = [[Color alloc] init];
            [col setValuesForKeysWithDictionary:aDic];
            [self.airpot addObject:col];
        }
        
        return;
    }
    [super setValue:value forKey:key];
}

- (NSMutableArray *)airpot{
    if (_airpot == nil) {
        _airpot = [NSMutableArray new];
    }
    return _airpot;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
}

@end